<?php
/**
 * Created by PhpStorm.
 * User: Season
 * Date: 2018/10/25
 * Time: 15:07
 */

namespace app\api\controller\v1;


use app\api\controller\BaseController;
use app\api\service\WxNotify;
use app\api\validate\IDMustBePostiveInt;
use app\api\service\Pay as PayService;
class Pay extends BaseController
{
    protected  $beforeActionList = [
        'checkExclusiveScope' => ['only' => 'placeOrder']
    ];
    public function getPreOrder($id = ''){
        (new IDMustBePostiveInt())->goCheck ();
        $payService = new  PayService($id);
        $payService->pay ();
    }

    public function receiveNotify(){
        $notify = new WxNotify();
        $config = new \WxPayConfig();
        $notify->Handle ($config);
    }

    public function receuveNotify(){
        $xmlData = file_get_contents('php://input');
        $result = curl(
            'http:/www2/api/v1/pay/re_notify?XDEBUG_SESSION_START=13133',
            'post',
            $xmlData,
            5,
            'Content-Type: text'
        );
        return $result;
    }
}